package com.weimei.conversionTreasure.viewModel;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableField;
import androidx.databinding.ObservableList;

import com.chad.library.BR;
import com.weimei.conversionTreasure.R;
import com.weimei.conversionTreasure.http.entity.BillBean;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.tatarka.bindingcollectionadapter2.ItemBinding;

public class BillItemVM extends ItemViewModel {

    public ObservableField<BillBean.DataDTO.DlistDTO> entity = new ObservableField<>();


    public ObservableList<BillItemIVM> observableList = new ObservableArrayList<>();
    public ItemBinding<BillItemIVM> itemBinding = ItemBinding.of(BR.viewModel, R.layout.item_bill_i);


    public BillItemVM(@NonNull BaseViewModel viewModel, BillBean.DataDTO.DlistDTO dlistDTO) {
        super(viewModel);
        entity.set(dlistDTO);
        for (BillBean.DataDTO.DlistDTO.DealDataDTO dealDataDTO: dlistDTO.getDealData()) {
            BillItemIVM itemIVM = new BillItemIVM(viewModel,dealDataDTO);
            observableList.add(itemIVM);
        }
    }

}
